//
//  CantripWorldWindow.m
//  Cantrip
//
//  Created by James Callender on Wed Apr 24 2002.
//  Copyright (c) 2001 James Callender. All rights reserved.
//

#import "CantripWorldWindow.h"


@implementation CantripWorldWindow
	
- (void)dealloc
{
    [super dealloc];
}

- (void)sendEvent:(NSEvent *)anEvent
{
    if ([self delegate]) {
        if ([anEvent type] == NSScrollWheel) {
            // Do something here
        }
    
        else if ([anEvent type] == NSKeyDown) {
            if ([[self delegate] respondsToSelector:@selector(keyDownInWindow:)]) {
                if ([[self delegate] keyDownInWindow:anEvent]) return;
            }
        }
    }
    
    [super sendEvent:anEvent];
}

// We need to let the settings modules switch pointers before we are deallocated
// not a bad hack...
- (void)close
{
    [self orderOut:self];
    [[NSNotificationCenter defaultCenter] postNotificationName:NSWindowDidBecomeMainNotification object:self];
    [super close];
}

- (id)world 
{  
    return [[self windowController] document]; 
}


@end
